module DisOrder
  class Index
    extend Helpers

    def self.build
      puts "-- Make Index Page".white

      baseTemplate = ERB.new(baseTemplate(), 0, "%<>")
      indexTemplate = ERB.new(indexTemplate(), 0, "%<>")

      @articles = articlesData()
      @contentBlock = indexTemplate.result(binding)
      @cssBlock = config("indexCSS")

      result = baseTemplate.result(binding)

      File.open("#{config("output")}/index.html", mode: "w:UTF-8") do |f|
        f.write result
      end
      puts "-- Created Index Page \n".white
    end
  end
end